import { StrictMode, Suspense } from "react";
import { createRoot } from "react-dom/client";
import Router from "@/router/Router";
import PageLoading from "@/components/PageLoading";
import "@/styles/index.css";
import { ErrorBoundary } from "react-error-boundary";
import ErrorPage from "@/components/ErrorPage";
// import TsDemo from "@/pages/TsDemo";

createRoot(document.getElementById("root")!).render(
  <StrictMode>
    <ErrorBoundary
      fallbackRender={({ error }) => (
        <ErrorPage errorTitle="应用程序错误" errorMessage={error.message} />
      )}
    >
      <Suspense fallback={<PageLoading />}>
        <Router />
      </Suspense>
    </ErrorBoundary>
    </StrictMode>
);
